using System;
using System.Collections.Generic;
using System.Text;

namespace Xeml.Document
{
    /// <summary>
    /// A message class to transfer validation information.
    /// </summary>
    public class ValidationMessage : EventArgs
    {
        #region Fields
        private SeverityCode severityCode;
        private string text;
        private object relatedObject;
        private bool inhibitRendering;

       
        #endregion

        #region Properties

        //public bool DocumentError
        //{
        //    get { return documentError; }
        //}


        /// <summary>
		/// The severity code for the message.
        /// </summary>
        public SeverityCode SeverityCode
        {
            get
            {
                return this.severityCode;
            }
        }

        /// <summary>
        /// A descibing string which gives information about the validation event.
        /// </summary>
        public string Text
        {
            get
            {
                return this.text;
            }
        }

        /// <summary>
        /// The retated object to this message
        /// </summary>
        public object RelatedObject
        {
            get
            {
                return this.relatedObject;
            }
        }

        /// <summary>
        /// A value which indicates if this validation event will inbit a possible rendering of the document.
        /// </summary>
        public bool InhibitRendering
        {
            get
            {
                return inhibitRendering;
            }

        } 
	#endregion

        #region Constructors
        /// <summary>
        /// A parameterized constructor.
        /// </summary>
        /// <param name="sev">The severity code.</param>
        /// <param name="text">The message text.</param>
        /// <param name="relObject">The related object to this message.</param>
        /// <param name="inhibitRend">The inhibit code for rendering.</param>
        //public ValidationMessage(SeverityCode sev, string text, object relObject, bool inhibitRend, bool docError)
        //{
        //    this.severityCode = sev;
        //    this.text = text;
        //    this.relatedObject = relObject;
        //    this.inhibitRendering = inhibitRend;
        //    this.documentError = docError;
        //}

        /// <summary>
        /// A parameterized constructor.
        /// </summary>
        /// <param name="sev">The severity code.</param>
        /// <param name="text">The message text.</param>
        /// <param name="relObject">The related object to this message.</param>
        /// <param name="inhibitRend">The inhibit code for rendering.</param>
        public ValidationMessage(SeverityCode sev, string text, object relObject, bool inhibitRend)
            //: this(sev, text, relObject, inhibitRend, false)
        {
            this.severityCode = sev;
            this.text = text;
            this.relatedObject = relObject;
            this.inhibitRendering = inhibitRend;
            //this.documentError = docError;
        }
         
        #endregion
    }


    public class XmlValidationMessage : ValidationMessage
    {
        private int _line;
        private int _col;
        public int Column
        {
            get { return _col; }
        }

        
        public int Line
        {
            get { return _line; }
        }


        public XmlValidationMessage(SeverityCode sev, string text, object relObject,bool inhibitRend, int line, int col)
            : base(sev, text, relObject, inhibitRend)
        {
            _line = line;
            _col = col;
        }
    }
}
